package util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.TextView;

@SuppressLint("DrawAllocation")
public class TableHeaderTextView extends TextView {
	public TableHeaderTextView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public TableHeaderTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public TableHeaderTextView(Context context) {
		super(context);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		Rect rect = new Rect();
		Paint paint = new Paint();
		paint.setStyle(Paint.Style.STROKE);
		paint.setColor(Color.BLACK);
		paint.setStrokeWidth(3);
		getLocalVisibleRect(rect);
		this.setPadding(5, 5, 5, 5);
		this.setGravity(TEXT_ALIGNMENT_GRAVITY);
		this.setBackgroundColor(Color.GRAY);
		canvas.drawRect(rect, paint);
	}
}